# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=itstool
pkgver=2.0.6
pkgrel=0
pkgdesc="ITS-based XML translation tool"
url="http://itstool.org/"
arch="noarch"
license="GPL-3.0-or-later"
depends="py3-libxml2 python3"
makedepends="autoconf automake"
checkdepends="diffutils gettext"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/itstool/itstool/archive/$pkgver.tar.gz
	fix-segfault.patch"

prepare() {
	default_prepare
	autoreconf -vif
}

build() {
	PYTHON="/usr/bin/python3" ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var
	make
}

check() {
	python3 tests/run_tests.py
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="900889d7c668eb87b516334702c926f1195e105a3568bc66c6bbc2b7e94302f6ae394a7de293dc516d11bca04fb1a25d150da06901c74df1a3714bdeb0a9cd03  itstool-2.0.6.tar.gz
a47ab86ee0ea7b8fa8329649cda28db91e106ffdc695836e55f274b406759e3945835dbaf32230a30f2afaf482aff0ef205a12d722a19a6ab874c8f33413df9a  fix-segfault.patch"
